﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Gmis.Web.Manage.Affairs
{
	public partial class LeaveWordManage : BasePage.PageBase
	{
        string StartTime = DateTime.Now.ToString("yyyy-MM-dd");
        string EndTime = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
		protected void Page_Load(object sender, EventArgs e)
		{
            bindData();

		}

       
        private void bindData()
        {
            string sFilter = buildFilter();
            BLL.LeaveWord bll = new BLL.LeaveWord();
            
            List<Model.LeaveWord> models = bll.GetModelList(sFilter);
            TotalCount = models.Count;
            RepeaterTr.DataSource = models.Skip((PageNum - 1) * NumPerPage).Take(NumPerPage);
            RepeaterTr.DataBind();
        }

        //生成过滤脚本
        private string buildFilter()
        {
            string sFilter = " 1=1 ";
            //
            StartTime = Request.Form["StartTime"];
            EndTime = Request.Form["EndTime"];
            if (!string.IsNullOrEmpty(StartTime))
                sFilter += " And leaveWordTime >= '" + StartTime +"'";
            if (!string.IsNullOrEmpty(EndTime))
            {
                sFilter += " And  leaveWordTime<='" + EndTime + "'";
 
            }
            return sFilter;
        }
	}
}